package com.myraff.viz;

public class Ntuple<T> {
	
	private int axis_id;
	private T[] data;
	
	public Ntuple(T... L) {
		/* No axis specified */
		axis_id = -1;
		data = L;
	}
	
	public void setID(int ID) {
		axis_id = ID;
	}
	
	public T[] getData() {
		return data;
	}
	
	public String toString() {
		String result = "";
		int len = data.length;
		if (len == 0)
			return null;
		else {
			result += data[0].toString();
			for (int i=1; i<len; i++) {
				result += "," + data[i].toString();
			}
		}
		return result;
	}
	
	public String toStringWithID() {
		String result = Integer.toString(axis_id) + ",";
		int len = data.length;
		if (len == 0)
			return null;
		else {
			result += data[0].toString();
			for (int i=1; i<len; i++) {
				result += "," + data[i].toString();
			}
		}
		return result;
	}
	
	public String toStringBars() {
		String result = "";
		int len = data.length;
		if (len == 0)
			return null;
		else {
			result += Integer.toString(axis_id) + ":";
			for (int i=0; i<len; i++)
				result += "|" + data[i].toString();
		}
		return result;
	}

}
